<?php

use admin\widgets\AdminToolbar;
use app\components\BaseGridView;
use app\models\Post;
use yii\helpers\Url;

?>

<?= AdminToolbar::widget(['search' => FALSE, 'dialog' => FALSE]); ?>

<?= \admin\widgets\AdminTabs::widget([
    'items' => Post::$cidLabels,
    'id' => 'cid',
    'all' => FALSE,
    'defaultValue' => Post::CID_TECH
]); ?>

<div class="row box" id="toolbar">
    <div class="col-md-9 col-sm-8 col-xs-7">
        <button href="<?= Url::to(['delete']); ?>" class="btn danger batch-delete">批量删除</button>
    </div>
</div>

<?= BaseGridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        //['class' => 'yii\grid\SerialColumn'],
        ['class' => 'yii\grid\CheckboxColumn'],
        'id',
        ['attribute' => 'title', 'contentOptions' => ['class' => 'text-left'], 'headerOptions' => ['class' => 'text-left']],
        'tag',
        'comments',
        ['attribute' => 'status', 'format' => 'raw', 'value' => function (Post $model) {
            return $model->_statusLabel();
        }],
        'ctime:datetime',
        ['class' => 'app\components\BaseActionColumn', 'template' => '{save} {delete}'],
    ],
]); ?>
